import { toRaw } from 'vue'
export default {
    install(app) {
        app.directive('perm', (el, binding) => {
            let { value, arr } = binding.value;
            arr = toRaw(arr);
            if (!value) {
                return true;
            }
            if (!Array.isArray(value)) {
                if (arr.includes(value)) {
                    return true;
                } else {
                    el.remove()
                }
            } else {
                for (let i = 0; i < arr.length; i++) {
                    if (value.includes(arr[i])) {
                        return true;
                    } else {
                        el.remove()
                    }
                }
            }
        })
    }
}